﻿namespace Devonline.Entity;

/// <summary>
/// 用户账户, 字符主键的默认实现
/// </summary>
[Table("account"), DisplayName("用户账户")]
public class Account : Account<string>, IEntitySet, IEntitySetWithCreate, IEntitySetWithCreateAndUpdate
{
    /// <summary>
    /// 账户所属用户个人信息
    /// </summary>
    public virtual Personal? Personal { get; set; }
}

/// <summary>
/// 账户交易记录
/// </summary>
[Table("account"), DisplayName("用户账户")]
public abstract class Account<TKey> : EntitySetWithCreateAndUpdate<TKey>, IEntitySet<TKey>, IEntitySetWithCreate<TKey>, IEntitySetWithCreateAndUpdate<TKey> where TKey : IConvertible
{
    /// <summary>
    /// 用户个人信息
    /// </summary>
    [Column("personal_id"), DisplayName("个人信息编号"), MaxLength(36), Excel]
    public virtual TKey? PersonalId { get; set; }
    /// <summary>
    /// 金额, 余额
    /// </summary>
    [Column("amount", TypeName = "DECIMAL(18,4)"), DisplayName("金额"), Excel]
    public virtual decimal Amount { get; set; }
}